package com.easepal802s.project.ui.presenter;


import com.ogawa.base.Constant.BleConstant;
import com.easepal802s.project.ble.BleController;
import com.easepal802s.project.ble.HexUtils;
import com.easepal802s.project.ui.iview.IShoulderAdjustView;


/**
 * 肩部检测
 * Created by FHB on 2018/4/4.
 */

public class ShoulderAdjustPresenter extends MBasePresenter {
    IShoulderAdjustView mView;
    private String mAdjustOk="-1" ;
    public ShoulderAdjustPresenter(IShoulderAdjustView view) {
        mView = view;
    }


    @Override
    public void getDatas(String data) {
        if (data.startsWith(BleConstant.BAG1_HEAD)) {
            if (!mAdjustOk.equals(HexUtils.getByteInPosition(data, 4, 6))) {
                mAdjustOk = HexUtils.getByteInPosition(data, 4, 6);
                if (mAdjustOk.equals("0")) {
                    BleController.getInst().setIsCanAdjust(false);
                    mView.isFinish();
                    return;
                } else {
                    BleController.getInst().setIsCanAdjust(false);
                }




            }

        }


    }



}
